package org.flexlancer.databases
{
	public class DropBillReasons
	{
		public static const TABLE:String = "dropreasons";

		public static function Add(reason:String,iscredit:int = 0):void{
			try{
				var insertObj:Object = new Object();
				insertObj.reason = reason;
				insertObj.iscredit = iscredit;
				DatabaseManager.Manager.Insert(TABLE,insertObj);
			}catch(err:Error){
				throw err;
			}
		}

		public static function Update(reason:String,iscredit:int = 0):void{
			try{
				var insertObj:Object = new Object();
				insertObj.iscredit = iscredit;
				DatabaseManager.Manager.Update(TABLE,insertObj,"reason LIKE '"+reason+"'");
			}catch(err:Error){
				throw err;
			}
		}

		public static function Delete(condition:String=""):void{
			try{
				DatabaseManager.Manager.Delete(TABLE,condition);
			}catch(err:Error){
				throw err;
			}
		}

		public static function List(condition:String = ""):Array{
			try{
				return DatabaseManager.Manager.Select(TABLE,null,condition,"reason");
			}catch(err:Error){
				throw err;
			}
			return new Array;
		}
	}
}